﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                float sum = 0;
                float sum1 = 0;
                float avg = 0;
                while (true)
                {
                    Console.WriteLine("请输入分数,结束请按0");
                    float a = float.Parse(Console.ReadLine());
                    if (a==0)
                    {
                        break;
                    }
                    else
                    {
                        
                        sum = sum + a;
                        
                        sum1 = sum1 + 1;
                       
                        avg = sum / sum1;
                    }
                    
                }
                Console.WriteLine("学生总数是{0}，总分是{1}，平均分是{2}", sum1,sum,avg);


            }
            catch (FormatException)
            {
                Console.WriteLine("异常已处理");

            }
            catch (OverflowException)
            {
                Console.WriteLine("异常已处理");
            }
            catch (Exception e) 
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                Console.WriteLine("就这？");
            }
            

        }
    }
}
